package main

import (
    "fmt"
)

func Append(slice []byte, data ...byte) []byte {
    length := len(slice)
    if length + len(data) > cap(slice) {
        newSlice := make([]byte, (length + len(data)) * 2)
        copy(newSlice, slice)
        slice = newSlice
    }
    slice = slice[0:length+len(data)]
    copy(slice[length:], data)
    return slice;
}

func main() {
    a := []byte{1,2,3,4,5}
    b := []byte{6,7,8,9}

    fmt.Println(Append(a, b...))
}
